\(\int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx\) [42]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 131 \[ \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {3 (i A-B) x}{2 a}+\frac {3 (i A-B) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}-\frac {(2 A+i B) \log (\sin (c+d x))}{a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))} \]

[Out]

3/2*(I*A-B)*x/a+3/2*(I*A-B)*cot(d*x+c)/a/d-1/2*(2*A+I*B)*cot(d*x+c)^2/a/d-(2*A+I*B)*ln(sin(d*x+c))/a/d+1/2*(A+
I*B)*cot(d*x+c)^2/d/(a+I*a*tan(d*x+c))

Rubi [A] (verified)

Time = 0.24 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {3677, 3610, 3612, 3556} \[ \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=-\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}+\frac {3 (-B+i A) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \log (\sin (c+d x))}{a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {3 x (-B+i A)}{2 a} \]

[In]

Int[(Cot[c + d*x]^3*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

(3*(I*A - B)*x)/(2*a) + (3*(I*A - B)*Cot[c + d*x])/(2*a*d) - ((2*A + I*B)*Cot[c + d*x]^2)/(2*a*d) - ((2*A + I*
B)*Log[Sin[c + d*x]])/(a*d) + ((A + I*B)*Cot[c + d*x]^2)/(2*d*(a + I*a*Tan[c + d*x]))

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3610

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b
*c - a*d)*((a + b*Tan[e + f*x])^(m + 1)/(f*(m + 1)*(a^2 + b^2))), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3677

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(a*A + b*B)*(a + b*Tan[e + f*x])^m*((c + d*Tan[e + f*x])^(n + 1)/(2*
f*m*(b*c - a*d))), x] + Dist[1/(2*a*m*(b*c - a*d)), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Si
mp[A*(b*c*m - a*d*(2*m + n + 1)) + B*(a*c*m - b*d*(n + 1)) + d*(A*b - a*B)*(m + n + 1)*Tan[e + f*x], x], x], x
] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0] &&  !GtQ[n,
0]

Rubi steps \begin{align*} \text {integral}& = \frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \cot ^3(c+d x) (2 a (2 A+i B)-3 a (i A-B) \tan (c+d x)) \, dx}{2 a^2} \\ & = -\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \cot ^2(c+d x) (-3 a (i A-B)-2 a (2 A+i B) \tan (c+d x)) \, dx}{2 a^2} \\ & = \frac {3 (i A-B) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}+\frac {\int \cot (c+d x) (-2 a (2 A+i B)+3 a (i A-B) \tan (c+d x)) \, dx}{2 a^2} \\ & = \frac {3 (i A-B) x}{2 a}+\frac {3 (i A-B) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {(2 A+i B) \int \cot (c+d x) \, dx}{a} \\ & = \frac {3 (i A-B) x}{2 a}+\frac {3 (i A-B) \cot (c+d x)}{2 a d}-\frac {(2 A+i B) \cot ^2(c+d x)}{2 a d}-\frac {(2 A+i B) \log (\sin (c+d x))}{a d}+\frac {(A+i B) \cot ^2(c+d x)}{2 d (a+i a \tan (c+d x))} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 1.82 (sec) , antiderivative size = 111, normalized size of antiderivative = 0.85 \[ \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {\frac {(A+i B) \cot ^3(c+d x)}{i+\cot (c+d x)}+3 i (A+i B) \cot (c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},-\tan ^2(c+d x)\right )-(2 A+i B) \left (\cot ^2(c+d x)+2 (\log (\cos (c+d x))+\log (\tan (c+d x)))\right )}{2 a d} \]

[In]

Integrate[(Cot[c + d*x]^3*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

(((A + I*B)*Cot[c + d*x]^3)/(I + Cot[c + d*x]) + (3*I)*(A + I*B)*Cot[c + d*x]*Hypergeometric2F1[-1/2, 1, 1/2,
-Tan[c + d*x]^2] - (2*A + I*B)*(Cot[c + d*x]^2 + 2*(Log[Cos[c + d*x]] + Log[Tan[c + d*x]])))/(2*a*d)

Maple [A] (verified)

Time = 0.15 (sec) , antiderivative size = 159, normalized size of antiderivative = 1.21

method result size
risch \(-\frac {5 x B}{2 a}+\frac {7 i x A}{2 a}-\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} B}{4 a d}-\frac {{\mathrm e}^{-2 i \left (d x +c \right )} A}{4 a d}-\frac {2 B c}{a d}+\frac {4 i A c}{a d}-\frac {2 i \left (B \,{\mathrm e}^{2 i \left (d x +c \right )}+i A -B \right )}{a d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}-\frac {i \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{a d}-\frac {2 A \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{a d}\) \(159\)
norman \(\frac {-\frac {A}{2 a d}-\frac {\left (-i A +B \right ) \tan \left (d x +c \right )}{a d}-\frac {3 \left (-i A +B \right ) \left (\tan ^{3}\left (d x +c \right )\right )}{2 a d}-\frac {3 \left (-i A +B \right ) x \left (\tan ^{2}\left (d x +c \right )\right )}{2 a}-\frac {3 \left (-i A +B \right ) x \left (\tan ^{4}\left (d x +c \right )\right )}{2 a}-\frac {\left (i B +2 A \right ) \left (\tan ^{2}\left (d x +c \right )\right )}{2 a d}}{\tan \left (d x +c \right )^{2} \left (1+\tan ^{2}\left (d x +c \right )\right )}-\frac {\left (i B +2 A \right ) \ln \left (\tan \left (d x +c \right )\right )}{a d}+\frac {\left (i B +2 A \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 a d}\) \(189\)
derivativedivides \(\frac {A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d a}+\frac {3 i A \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}+\frac {i B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d a}-\frac {3 B \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}+\frac {i A}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {B}{2 d a \left (\tan \left (d x +c \right )-i\right )}+\frac {i A}{a d \tan \left (d x +c \right )}-\frac {B}{a d \tan \left (d x +c \right )}-\frac {A}{2 a d \tan \left (d x +c \right )^{2}}-\frac {i B \ln \left (\tan \left (d x +c \right )\right )}{a d}-\frac {2 A \ln \left (\tan \left (d x +c \right )\right )}{a d}\) \(201\)
default \(\frac {A \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d a}+\frac {3 i A \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}+\frac {i B \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d a}-\frac {3 B \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}+\frac {i A}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {B}{2 d a \left (\tan \left (d x +c \right )-i\right )}+\frac {i A}{a d \tan \left (d x +c \right )}-\frac {B}{a d \tan \left (d x +c \right )}-\frac {A}{2 a d \tan \left (d x +c \right )^{2}}-\frac {i B \ln \left (\tan \left (d x +c \right )\right )}{a d}-\frac {2 A \ln \left (\tan \left (d x +c \right )\right )}{a d}\) \(201\)

[In]

int(cot(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

-5/2*x/a*B+7/2*I*x/a*A-1/4*I/a/d*exp(-2*I*(d*x+c))*B-1/4/a/d*exp(-2*I*(d*x+c))*A-2/a/d*B*c+4*I/a/d*A*c-2*I*(B*
exp(2*I*(d*x+c))+I*A-B)/a/d/(exp(2*I*(d*x+c))-1)^2-I/a/d*ln(exp(2*I*(d*x+c))-1)*B-2*A/a/d*ln(exp(2*I*(d*x+c))-
1)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 188, normalized size of antiderivative = 1.44 \[ \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=-\frac {2 \, {\left (-7 i \, A + 5 \, B\right )} d x e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (4 \, {\left (7 i \, A - 5 \, B\right )} d x + A + 9 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, {\left ({\left (-7 i \, A + 5 \, B\right )} d x - 5 \, A - 5 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 4 \, {\left ({\left (2 \, A + i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} - 2 \, {\left (2 \, A + i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (2 \, A + i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) + A + i \, B}{4 \, {\left (a d e^{\left (6 i \, d x + 6 i \, c\right )} - 2 \, a d e^{\left (4 i \, d x + 4 i \, c\right )} + a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \]

[In]

integrate(cot(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/4*(2*(-7*I*A + 5*B)*d*x*e^(6*I*d*x + 6*I*c) + (4*(7*I*A - 5*B)*d*x + A + 9*I*B)*e^(4*I*d*x + 4*I*c) + 2*((-
7*I*A + 5*B)*d*x - 5*A - 5*I*B)*e^(2*I*d*x + 2*I*c) + 4*((2*A + I*B)*e^(6*I*d*x + 6*I*c) - 2*(2*A + I*B)*e^(4*
I*d*x + 4*I*c) + (2*A + I*B)*e^(2*I*d*x + 2*I*c))*log(e^(2*I*d*x + 2*I*c) - 1) + A + I*B)/(a*d*e^(6*I*d*x + 6*
I*c) - 2*a*d*e^(4*I*d*x + 4*I*c) + a*d*e^(2*I*d*x + 2*I*c))

Sympy [A] (verification not implemented)

Time = 0.41 (sec) , antiderivative size = 199, normalized size of antiderivative = 1.52 \[ \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {2 A - 2 i B e^{2 i c} e^{2 i d x} + 2 i B}{a d e^{4 i c} e^{4 i d x} - 2 a d e^{2 i c} e^{2 i d x} + a d} + \begin {cases} \frac {\left (- A - i B\right ) e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: a d e^{2 i c} \neq 0 \\x \left (- \frac {7 i A - 5 B}{2 a} + \frac {\left (7 i A e^{2 i c} + i A - 5 B e^{2 i c} - B\right ) e^{- 2 i c}}{2 a}\right ) & \text {otherwise} \end {cases} + \frac {x \left (7 i A - 5 B\right )}{2 a} - \frac {\left (2 A + i B\right ) \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a d} \]

[In]

integrate(cot(d*x+c)**3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)

[Out]

(2*A - 2*I*B*exp(2*I*c)*exp(2*I*d*x) + 2*I*B)/(a*d*exp(4*I*c)*exp(4*I*d*x) - 2*a*d*exp(2*I*c)*exp(2*I*d*x) + a
*d) + Piecewise(((-A - I*B)*exp(-2*I*c)*exp(-2*I*d*x)/(4*a*d), Ne(a*d*exp(2*I*c), 0)), (x*(-(7*I*A - 5*B)/(2*a
) + (7*I*A*exp(2*I*c) + I*A - 5*B*exp(2*I*c) - B)*exp(-2*I*c)/(2*a)), True)) + x*(7*I*A - 5*B)/(2*a) - (2*A +
I*B)*log(exp(2*I*d*x) - exp(-2*I*c))/(a*d)

Maxima [F(-2)]

Exception generated. \[ \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate(cot(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [A] (verification not implemented)

none

Time = 0.69 (sec) , antiderivative size = 160, normalized size of antiderivative = 1.22 \[ \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {\frac {{\left (A - i \, B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a} + \frac {{\left (7 \, A + 5 i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a} - \frac {4 \, {\left (2 \, A + i \, B\right )} \log \left (\tan \left (d x + c\right )\right )}{a} - \frac {7 \, A \tan \left (d x + c\right ) + 5 i \, B \tan \left (d x + c\right ) - 9 i \, A + 7 \, B}{a {\left (\tan \left (d x + c\right ) - i\right )}} + \frac {2 \, {\left (6 \, A \tan \left (d x + c\right )^{2} + 3 i \, B \tan \left (d x + c\right )^{2} + 2 i \, A \tan \left (d x + c\right ) - 2 \, B \tan \left (d x + c\right ) - A\right )}}{a \tan \left (d x + c\right )^{2}}}{4 \, d} \]

[In]

integrate(cot(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

1/4*((A - I*B)*log(tan(d*x + c) + I)/a + (7*A + 5*I*B)*log(tan(d*x + c) - I)/a - 4*(2*A + I*B)*log(tan(d*x + c
))/a - (7*A*tan(d*x + c) + 5*I*B*tan(d*x + c) - 9*I*A + 7*B)/(a*(tan(d*x + c) - I)) + 2*(6*A*tan(d*x + c)^2 +
3*I*B*tan(d*x + c)^2 + 2*I*A*tan(d*x + c) - 2*B*tan(d*x + c) - A)/(a*tan(d*x + c)^2))/d

Mupad [B] (verification not implemented)

Time = 7.94 (sec) , antiderivative size = 153, normalized size of antiderivative = 1.17 \[ \int \frac {\cot ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {3\,A}{2\,a}+\frac {B\,3{}\mathrm {i}}{2\,a}\right )+\frac {A}{2\,a}-\mathrm {tan}\left (c+d\,x\right )\,\left (-\frac {B}{a}+\frac {A\,1{}\mathrm {i}}{2\,a}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^3\,1{}\mathrm {i}+{\mathrm {tan}\left (c+d\,x\right )}^2\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (2\,A+B\,1{}\mathrm {i}\right )}{a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )}{4\,a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (7\,A+B\,5{}\mathrm {i}\right )}{4\,a\,d} \]

[In]

int((cot(c + d*x)^3*(A + B*tan(c + d*x)))/(a + a*tan(c + d*x)*1i),x)

[Out]

(log(tan(c + d*x) + 1i)*(A - B*1i))/(4*a*d) - (log(tan(c + d*x))*(2*A + B*1i))/(a*d) - (tan(c + d*x)^2*((3*A)/
(2*a) + (B*3i)/(2*a)) + A/(2*a) - tan(c + d*x)*((A*1i)/(2*a) - B/a))/(d*(tan(c + d*x)^2 + tan(c + d*x)^3*1i))
+ (log(tan(c + d*x) - 1i)*(7*A + B*5i))/(4*a*d)